<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>login</title>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<style>
  body{
    width: 100%;
    height: 100%;
    background: #c5cbee;
  }
  .box{
    display: flex;
    /* align-items: center;
    justify-items: start; */
    flex-direction: column;
    margin: 100px auto;
    width: 34%;
    height: 320px;
    background: #abb5eb;
  
  }
  .box>header{
    width: 100%;
    height: 48px;
    line-height: 48px;
    text-align: center;
    color: #ffffff;
    font-size: 18px;
    background: #97a3e9;
    font-weight: 500;
  }
 
  label{
    width: 36px;
    text-align: right;
    line-height: 48px;
    height: 48px;
    margin-right: 12px;
  }
  .inputItem{
    display: flex;
    align-items: center;
    height: 48px;
  }
  .inputBox{
    margin: 16px auto;
  }
  input{
    height: 24px;
    width: 202px;
    background: #e0e3f5;
    outline: none;
    border: 1px solid #c5cbee;
    border-radius: 4px;
  }
  .inputItem:last-child{
    position: absolute;
  }
  .code{
    display: inline-block;
    height: 26px;
    line-height: 26px;
    width: 90px;
    text-align: center;
    background: #ffffff;
    color: #97a3e9;
    position: relative;
    top: 0px;
    right: 91px;
    font-size: 14px;
  }
  .inputBox>.bottonItem{
    display: flex;
    align-items: flex-end;
  }
  .inputBox>.bottonItem>button{
    width:65%;
    height: 36px;
    line-height: 36px;
    margin-top: 16px;
    border: none;
    border-radius: 4px;
background: #97a3e9;
font-size: 18px;
color: #ffffff;
margin-right: 8px;
  }
</style>
<script type="text/javascript">

	

$(function(){


	$('#btn').click(function(event) {
	 
	 	var email= $('#email').val();
	var password=$('#password').val();

 $.ajax({
            //请求方式
            type : "GET",
            //请求的媒体类型
            url : 'http://127.0.0.1/api/user/login/'+email+'/'+password,
            //请求成功
            success : function(result) {
                 console.log(result);

                if(result==false){
                    alert('没有注册或者密码不对')
                }
                else location.href='./index.html?email='+email;
            },
            //请求失败，包含具体的错误信息
            error : function(e){

                  alert(e.responseText);
            }
        });
	});

})


 


</script>

</head>
<body>
    <div class="box">
      <header>账户登录</header>
      <div class="inputBox" >
        <div class="inputItem">
            <label>邮箱</label><input id="email" type="text" name="email">
        </div>
        <div class="inputItem">
            <label>密码</label> <input id="password" type="password" name="password"> 
        </div>
        <div class="bottonItem">
          <button id="btn" type="button"  >登陆</button>
          <a href="./reg.html">注册新账号</a>
        </div>
       

      </div>
      </div>

</body>
</html>